home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Utilities ƒ / MPW Tools ƒ / Split-Join Folder / Join next >
Encoding:
Text File  |  1989-09-25  |  1.4 KB  |  69 lines  |  [TEXT/MPS ]

  1. # syntax join file1 file2 … > combinedFile 
  2. # Combine dismembered binhex files
  3. # Comments at the start of first part echoed to Worksheet
  4.  
  5. Set Exit 0                # keep going
  6. Set CaseSensitive 1
  7.  
  8. Set part 1
  9.  
  10. For i in {"Parameters"}
  11.     If "{i}" == '§'
  12.         Mark -y § OldSel "{Target}"
  13.         Find Δ§
  14.     Else
  15.         Target "{i}"        # put the file in a window
  16.         Find •
  17.     End
  18.     Loop
  19.         Find Δ/part [0-9]+ of [0-9]+]/!5:Δ/ /
  20.         Break If {status} ≠ 0
  21.         Set cur "`Catenate §`"
  22.         If {cur} ≠ {part}
  23.             Echo "Out of order" > "Dev:StdErr"
  24.             Exit 2
  25.         End
  26.         If {cur} == 1
  27.             # Find out how many parts there areFind
  28.             Find Δ/[0-9]+]/:Δ/]/
  29.             Set last `Catenate §`
  30.             # Copy comments in the first part to std err
  31.             Find !0:Δ/∂(This file must/
  32.             Catenate § > "Dev:StdErr"
  33.         Else
  34.             Find !0
  35.             Echo -n "### " > "Dev:StdErr"
  36.             Catenate § > "Dev:StdErr"
  37.             Find /•---/!1
  38.         End
  39.         # Grab the contents of part n
  40.         Find §Δ:Δ/--- end of part {cur}/
  41.         Catenate §
  42.         Find Δ!1
  43.         Set part `Evaluate {part} + 1`
  44.     End
  45.     If {cur} == {last}
  46.         Find ¡1Δ
  47.         Find §¡1:§¡1
  48.         Set char "`Catenate §`"
  49.         If ("{char}" ≠ ":")
  50.             Echo "Parts incomplete or out of order" > "Dev:StdErr"
  51.             Exit 2
  52.         End
  53.     End
  54.     If "{i}" != '§'
  55.         Find ∞
  56.         Close "{i}"
  57.     Else
  58.         Find 'OldSel'
  59.         Unmark 'OldSel' "{Target}"
  60.     End
  61. End
  62.  
  63. If ({cur} ≠ {last})
  64.     Echo "Parts `Evaluate {cur} + 1` to {last} missing" > "Dev:StdErr"
  65.     Exit 2
  66. Else
  67.     Echo "### Joined {cur} parts of {last}" > "Dev:StdErr"
  68. End
  69.